package tests;

import junit.framework.Assert;

import org.junit.Before;
import org.junit.Test;

import exceptions.InvalidUserAddress;
import exceptions.InvalidUserName;
import exceptions.InvalidUserUsername;

import root.friendship.Friendship;
import root.friendship.FriendshipState;
import root.user.User;
import strategy.AbstractStrategyFactory;


public class FriendshipTest {
	Friendship friendship;
	User a, b;
	@Before
	public void setUp() throws InvalidUserUsername, InvalidUserName, InvalidUserAddress{
	//	friendship = new Friendship();
		a = new User("oi", "oi", "oi",AbstractStrategyFactory.getInstance());
		b = new User("ola", "ola", "ola", AbstractStrategyFactory.getInstance());
		
		friendship = new Friendship(a, b);
	}
	
	@Test
	public void testRequest() {
		Assert.assertEquals(friendship.getFriendshipState(), FriendshipState.Requested);
	}
	
	@Test
	public void testEqualsRequester() {
		Assert.assertEquals(a, friendship.getRequester());
	}
	
	@Test
	public void testEqualsTarget() {
		Assert.assertEquals(b, friendship.getTarget());
	}

	@Test
	public void testChangeState() {
		friendship.setFriendshipState(FriendshipState.Accepted);
		Assert.assertEquals(friendship.getFriendshipState(), FriendshipState.Accepted);
	}

	
	
}
